<?php
require('header.php');

if(isset($_REQUEST['technology']) && $_REQUEST['technology']) {
    $tech = $_REQUEST['technology'];
    $sql="INSERT INTO technology (technology) VALUES('$tech')";
    mysql_query($sql) or die('Can not add to database.');
    $add_tech=1;
}

$sql="SELECT * FROM technology";
$tech=mysql_query($sql) or die('Could not load technologies from DB.');
?>
	<h1>Add a new Technology</h1>
	<hr>
	<div class="span6">
		<label>Existing Technologies</label>
		<div class="alert alert-info">
            <ul>
			<?php
			while($row=mysql_fetch_assoc($tech)) {
				echo '<li>'. $row['technology'].'</li>';
			}
			?>
            </ul>
		</div>
	</div>
	<div class="span6">
	<form class="well" method="post" action="<?=$_SERVER['PHP_SELF'];?>">
		<label>Technology</label>
		<input type="text" name="technology" placeholder="Reference Title" class="span4" />
        <input type="submit" name="submit" value="Submit" class="btn-primary">
    </form>
    </div>

    </div> <!-- /container -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap-transition.js"></script>
    <script src="assets/js/bootstrap-alert.js"></script>
    <script src="assets/js/bootstrap-modal.js"></script>
    <script src="assets/js/bootstrap-dropdown.js"></script>
    <script src="assets/js/bootstrap-scrollspy.js"></script>
    <script src="assets/js/bootstrap-tab.js"></script>
    <script src="assets/js/bootstrap-tooltip.js"></script>
    <script src="assets/js/bootstrap-popover.js"></script>
    <script src="assets/js/bootstrap-button.js"></script>
    <script src="assets/js/bootstrap-collapse.js"></script>
    <script src="assets/js/bootstrap-carousel.js"></script>
    <script src="assets/js/bootstrap-typeahead.js"></script>
    <script src="assets/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
        <script type="text/javascript" >
		tinyMCE.init({
        mode : "textareas",
        theme : "simple"   //(n.b. no trailing comma, this will be critical as you experiment later)
		});
	</script >

  </body>
</html>
